package cn.edu.neusoft.practice.Controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.edu.neusoft.practice.mapper.SpecialMapper;
import cn.edu.neusoft.practice.po.Special;

//G3王胤霖
@CrossOrigin
@Controller
public class SpecialController {
	//
	@Autowired
	private SpecialMapper SpecialMapper;
	
	@RequestMapping("/getAllSpecials")
	@ResponseBody
	public List<Special> getAllSpecials(){
		return SpecialMapper.getAllSpecials();
	}
	
	@RequestMapping("/addSpecial")//加 为凑齐方法接口
    @ResponseBody
    public int addSpecial(Special s){
		
      return SpecialMapper.insert(s);
    }
	

    @RequestMapping("/deleteSpecial")//删
    @ResponseBody
    public List<Special> deleSpecial(int userId){
      return SpecialMapper.logicdelete(userId);
    }
    
    @RequestMapping("/getSpecialsWithUser")//显示user表里有special属性的用户全部信息
    @ResponseBody
    public List<Special> getSpecialsWithUser(){
    	//return SpecialMapper.selectList(null); //针对单表的查询方法
		return SpecialMapper.getSpecialsWithUser();
	}

}
